
import javax.swing.JOptionPane;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Administrator
 */
public class stJudge {

    public static String sYear;
    public static String sMonth;
    public static String sDay;
    public static String sBH;
    public static String sBM;
    public static String sEH;
    public static String sEM;
    
    public static String bYear;
    public static String bMonth;
    public static String bDay;
    public static String eYear;
    public static String eMonth;
    public static String eDay;

    public static void stJudgeFirst(int x) {
        int y = x;
        switch (y) {
            case 0: {
                sYear = FirstFrame.stYear.getText();
                int iYear = Integer.parseInt(sYear);
                if (iYear < 10000 && iYear > 999) {
                    break;
                } else if (iYear >= 0 && iYear < 100) {
                    sYear = "20" + FirstFrame.stYear.getText();
                    FirstFrame.stYear.setText(sYear);
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 1: {
                sMonth = FirstFrame.stMonth.getText();
                int iMonth = Integer.parseInt(sMonth);
                if (iMonth > 0 && iMonth <= 9) {
                    sMonth = "0" + FirstFrame.stMonth.getText();
                    FirstFrame.stMonth.setText(sMonth);
                    break;
                } else if (iMonth > 9 && iMonth < 13) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 2: {
                sDay = FirstFrame.stDay.getText();
                int iDay = Integer.parseInt(sDay);
                if (iDay > 0 && iDay <= 9) {
                    sDay = "0" + FirstFrame.stDay.getText();
                    FirstFrame.stDay.setText(sDay);
                    break;
                } else if (iDay > 9 && iDay < 32) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 3: {
                sBH = FirstFrame.stBH.getText();
                int iBH = Integer.parseInt(sBH);
                if (iBH >= 0 && iBH <= 9) {
                    sBH = "0" + FirstFrame.stBH.getText();
                    FirstFrame.stBH.setText(sBH);
                    break;
                } else if (iBH > 9 && iBH < 24) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 4: {
                sBM = FirstFrame.stBM.getText();
                int iBM = Integer.parseInt(sBM);
                if (iBM >= 0 && iBM <= 9) {
                    sBM = "0" + FirstFrame.stBM.getText();
                    FirstFrame.stBM.setText(sBM);
                    break;
                } else if (iBM > 9 && iBM < 60) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 5: {
                sEH = FirstFrame.stEH.getText();
                int iEH = Integer.parseInt(sEH);
                if (iEH >= 0 && iEH <= 9) {
                    sEH = "0" + FirstFrame.stEH.getText();
                    FirstFrame.stEH.setText(sEH);
                    break;
                } else if (iEH > 9 && iEH < 24) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 6: {
                sEM = FirstFrame.stEM.getText();
                int iEM = Integer.parseInt(sEM);
                if (iEM >= 0 && iEM <= 9) {
                    sEM = "0" + FirstFrame.stEM.getText();
                    FirstFrame.stEM.setText(sEM);
                    break;
                } else if (iEM > 9 && iEM < 60) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }

            }
        }

    }

    public static void stJudgeMain(int x) {
        int y = x;
        switch (y) {
            case 0: {
                bYear = MainFrame.mBYear.getText();
                int iYear = Integer.parseInt(bYear);
                if (iYear < 10000 && iYear > 999) {
                    break;
                } else if (iYear >= 0 && iYear < 100) {
                    bYear = "20" + MainFrame.mBYear.getText();
                    MainFrame.mBYear.setText(bYear);
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 1: {
                bMonth = MainFrame.mBMonth.getText();
                int iMonth = Integer.parseInt(bMonth);
                if (iMonth > 0 && iMonth <= 9) {
                    bMonth = "0" + MainFrame.mBMonth.getText();
                    MainFrame.mBMonth.setText(bMonth);
                    break;
                } else if (iMonth > 9 && iMonth < 13) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 2: {
                bDay = MainFrame.mBDay.getText();
                int iDay = Integer.parseInt(bDay);
                if (iDay > 0 && iDay <= 9) {
                    bDay = "0" + MainFrame.mBDay.getText();
                    MainFrame.mBDay.setText(bDay);
                    break;
                } else if (iDay > 9 && iDay < 32) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 3: {
                eYear = MainFrame.mEYear.getText();
                int iYear = Integer.parseInt(eYear);
                if (iYear < 10000 && iYear > 999) {
                    break;
                } else if (iYear >= 0 && iYear < 100) {
                    eYear = "20" + MainFrame.mEYear.getText();
                    MainFrame.mEYear.setText(eYear);
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 4: {
                eMonth = MainFrame.mEMonth.getText();
                int iMonth = Integer.parseInt(eMonth);
                if (iMonth > 0 && iMonth <= 9) {
                    eMonth = "0" + MainFrame.mEMonth.getText();
                    MainFrame.mEMonth.setText(eMonth);
                    break;
                } else if (iMonth > 9 && iMonth < 13) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
            case 5: {
                eDay = MainFrame.mEDay.getText();
                int iDay = Integer.parseInt(eDay);
                if (iDay > 0 && iDay <= 9) {
                    eDay = "0" + MainFrame.mEDay.getText();
                    MainFrame.mEDay.setText(eDay);
                    break;
                } else if (iDay > 9 && iDay < 32) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, "输入的数值非法 ");
                    break;
                }
            }
        }
    }
}
